import * as actionTypes from './constance'
import {subcount,artistSublist,mvSublist} from '@/services/myMusic'
// import {loginStatus} from '@/services/login'
import {getPlaylistDynamic} from '@/services/song';



const subCountInfo = (res) => ({
    type:actionTypes.SUBCOUNT,
    subCounts:res
})

const artistSublistInfo = (res) => ({
    type:actionTypes.ARTISTSUBLISTINFO,
    artistSublists:res
})

const mvSublistInfo = (res) => ({
    type:actionTypes.MVSUBLIST,
    mvSublists:res
})

const playlistAction = (res) => ({
    type:actionTypes.GETPLAYLISTCONTENT,
    playlists:res
})

// const loginStatu = (res) => ({
//     type:actionTypes.LOGINSTATUS,
//     isLogin:res

// })


export const subCountAction = () => {
    return dispatch => {
        subcount().then(res=>{
            dispatch(subCountInfo(res))
        })
    }
}

export const artistSublistAction = () => {
    return dispatch => {
        artistSublist().then(res=>{
            dispatch(artistSublistInfo(res))
        })
    }
}

export const mvSublistAction = () => {
    return dispatch => {
        mvSublist().then(res=>{
            dispatch(mvSublistInfo(res))
        })
    }
}

export const getPlaylistXq = (id) => {
    return dispatch => {
        getPlaylistDynamic(id).then(res=>{
            dispatch(playlistAction(res))
        })
    }
}

// export const loginStatusAction = () => {
//     return dispatch => {
//         loginStatus().then(res=>{
//             dispatch(loginStatu(res))
//         })
//     }
// }